<?php echo $this->fetch('header.html'); ?>
<div class="conter">
  <?php echo $this->fetch('header.common.html'); ?>
<style>
.kdorder_add {background:#dddddd;}
.kdorder_add td{padding:6px; background:#FFF}
.kdorder_add .title_h1 {font-size:13px; color:#333; background:#d8ecfc; font-family:'Microsoft Yahei'}
.kdorder_add em {color:#F00; font-style:normal; margin-right:3px}
.inputBorder{border: 1px #CCC solid;height: 20px;line-height: 20px;padding: 2px 4px;}
.fuwu_xz {list-style:none; width:100%; overflow:hidden}
.fuwu_xz li {line-height:25px;text-align:left; float:left; width:50%;}
.adders_cass{width:100%;border:1px #ffcc33 solid; background:#ffffef; font-size:12px}
.adders_cass th{width:80px;font-weight:normal;text-align:right;}
.adders_cass td {padding:3px 0; background:#ffffef}
.adders_cass .inputBorder {width:90%}

.address_item {padding:3px; font-size:12px}
.wupin_sc{padding:8px; border-bottom:1px #f0f7ff solid}
.wupin_sc p{width:100%; padding:3px 0;}
</style>
<div class="content_color">
<div class="content">
<div id="right">
<div class="wrap">
<?php if ($_GET['act'] != 'view' && $_GET['act'] != 'import'): ?>

<form action="" method="post" id="form_box">
<table cellspacing="0" width="100%" class="kdorder_add">
  <tr><td colspan="4" style="padding:12px 8px;background:#ffffe5;font-size:12px">提示：每个包裹丢件赔偿上限为$100美元（易碎品/奶粉/液体等无破损赔偿，建议选择加固服务以降低破损）。</td></tr>
  <tr><td colspan="4" class="title_h1">&nbsp;一、客户委托项目</td></tr>
  <tr>
      <td align="center" style="background:#FBFBFB">发货地</td>
      <td align="center" style="background:#FBFBFB">收货地</td>
      <td align="center" style="background:#FBFBFB">发出仓库</td>
      <td align="center" style="background:#FBFBFB">转运方式</td>
  </tr><tr>
      <td align="center">
      <select name="FromCountry" id="FromCountry" onchange="class_Change(this.value,'ToCountry');$('#FaHuoDi').val($(this).find('option:selected').attr('rel'))" class="select_class" style="width:80px">
      <option value="0">请选择</option>
      <?php $_from = $this->_var['regions']['0']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'list');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['list']):
?>
      <option value="<?php echo $this->_var['key']; ?>" rel="<?php echo $this->_var['list']; ?>" <?php if ($this->_var['choose_xiangmu']['0'] == $this->_var['key']): ?>selected="selected"<?php endif; ?>><?php echo $this->_var['list']; ?></option>
      <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
      </select>
      </td>
      <td align="center">
      <select name="ToCountry" id="ToCountry" onchange="class_Change(this.value,'ExpressCompany');$('#ShouHuoDi').val($(this).find('option:selected').attr('rel'))" class="select_class" style="width:80px">
      <option value="0">请选择</option>
      <?php $_from = $this->_var['regions']['1']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'list');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['list']):
?>
      <option value="<?php echo $this->_var['key']; ?>" rel="<?php echo $this->_var['list']; ?>" <?php if ($this->_var['choose_xiangmu']['1'] == $this->_var['key']): ?>selected="selected"<?php endif; ?>><?php echo $this->_var['list']; ?></option>
      <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>      
      </select>
      </td>
      <td align="center">
      <select name="ExpressCompany" id="ExpressCompany" onchange="class_Change(this.value,'TransportType');$('#CangKuDiZhi').val($(this).find('option:selected').attr('rel'))" class="select_class" style="width:80px">
      <option value="0">请选择</option>
      <?php $_from = $this->_var['regions']['2']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'list');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['list']):
?>
      <option value="<?php echo $this->_var['key']; ?>" rel="<?php echo $this->_var['list']; ?>" <?php if ($this->_var['choose_xiangmu']['2'] == $this->_var['key']): ?>selected="selected"<?php endif; ?>><?php echo $this->_var['list']; ?></option>
      <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>       
      </select>
      </td>
      <td align="center">
      <select name="TransportType" id="TransportType" onchange="$('#ZhuanYunFangShi').val($(this).find('option:selected').attr('rel'))" class="select_class" style="width:80px">
      <option value="0">请选择</option>
      <?php $_from = $this->_var['regions']['3']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'list');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['list']):
?>
      <option value="<?php echo $this->_var['key']; ?>" rel="<?php echo $this->_var['list']; ?>" <?php if ($this->_var['choose_xiangmu']['3'] == $this->_var['key']): ?>selected="selected"<?php endif; ?>><?php echo $this->_var['list']; ?></option>
      <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>       
      </select>
      </td>
  </tr>
  <tr <?php if ($this->_var['order_info']['order_id'] && ! $this->_var['order_info']['xiangmu']): ?><?php else: ?>style="display:none"<?php endif; ?>>
    <td align="center"><input type="input" class="inputBorder" style="width:70px" name="FaHuoDi" id="FaHuoDi" value="<?php echo $this->_var['order_info']['FaHuoDi']; ?>"/></td>
    <td align="center"><input type="input" class="inputBorder" style="width:70px" name="ShouHuoDi" id="ShouHuoDi" value="<?php echo $this->_var['order_info']['ShouHuoDi']; ?>"/></td>
    <td align="center"><input type="input" class="inputBorder" style="width:70px" name="CangKuDiZhi" id="CangKuDiZhi" value="<?php echo $this->_var['order_info']['CangKuDiZhi']; ?>"/></td>
    <td align="center"><input type="input" class="inputBorder" style="width:70px" name="ZhuanYunFangShi" id="ZhuanYunFangShi" value="<?php echo $this->_var['order_info']['ZhuanYunFangShi']; ?>"/></td>
  </tr>
  </table>
<table width="100%" cellspacing="0" class="kdorder_add" style="margin-top:15px" id="wupin_add">
  <tr>
    <td class="title_h1">&nbsp;二、快件物品详情(最多4个包裹)</td></tr>
  <tr>
      <td style="padding:0"></td>
  </tr>
  <?php $_from = $this->_var['order_info']['goodswupin']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'wupin');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['wupin']):
?>
  <tr id="wupin_id_<?php echo($this->_var['key']+3);?>">
    <td style="padding:0">
    <div class="wupin_sc">
      <p><em>*</em>发货跟踪：<select name="PostOfficeID[]" id="PostOfficeID" onchange="postofficchange(this,'wupin_id_<?php echo($this->_var['key']+3);?>');" class="select_class">
      <option value="">请选择</option>
      <?php $_from = $this->_var['kuaidi_data']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('i', 'list');if (count($_from)):
    foreach ($_from AS $this->_var['i'] => $this->_var['list']):
?><?php if ($this->_var['list']['type'] == "1"): ?>
      <option value="<?php echo $this->_var['list']['title']; ?>" <?php if ($this->_var['wupin']['PostOfficeID'] == $this->_var['list']['title']): ?>selected="selected"<?php endif; ?>><?php echo $this->_var['list']['title']; ?></option>
      <?php endif; ?><?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
      </select>
      <input name="PostNumber[]" type="text" class="inputBorder" id="PostNumber" style="width:120px" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')" value="<?php echo $this->_var['wupin']['yundanhao']; ?>" size="30" maxlength="30"/>
      <input type="hidden" name="yubao_id[]" id="yubao_id" value="<?php echo $this->_var['wupin']['yubao_id']; ?>"/>&nbsp;&nbsp;
      <img src="<?php echo $this->res_base . "/" . 'style/images/baoguo_del.gif'; ?>" align="absmiddle" style="cursor:pointer" title="删除该行包裹" onclick="deletes('wupin_id_<?php echo($this->_var['key']+3);?>')"/>
      </p>
      <p><em>*</em>商品明细：<input type="text" class="inputBorder" id="GoodsName" name="GoodsName[]" value="<?php echo $this->_var['wupin']['GoodsName']; ?>" placeholder="请按照【英文品牌 中文品名 数量】的格式填写" style="width:250px"/></p>
      <p><em>*</em>商品数量：<input type="text" class="inputBorder" id="GoodsCount" name="GoodsCount[]" value="<?php echo ($this->_var['wupin']['GoodsCount'] == '') ? '0' : $this->_var['wupin']['GoodsCount']; ?>" onblur="Sum();" onkeyup="clearNoNum(this)" maxlength="3" style="width:70px"/>
         <em>*</em>申报价值($)：<input type="text" class="inputBorder" id="GoodsWorth" name="GoodsWorth[]" value="<?php echo ($this->_var['wupin']['GoodsWorth'] == '') ? '0' : $this->_var['wupin']['GoodsWorth']; ?>" onkeyup="clearNoNum(this)" onblur="Sum();"  style="width:80px"/>
      </p>
    </div>    
    </td>
  </tr>
  <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
</table>
<table width="100%" cellspacing="0" class="kdorder_add">
  <tr>
    <td align="left" style="background:#f0f7ff"><img src="<?php echo $this->res_base . "/" . 'style/images/baoguo_add.gif'; ?>" onclick="tbladdrows(1);" style="cursor:pointer;"/></td>
    <td align="right" style="background:#f0f7ff">
    总数量 <input name="SumGoodsAmount" type="text" id="SumGoodsAmount" class="inputBorder" size="10" value="<?php echo $this->_var['order_info']['SumGoodsAmount']; ?>" style="width:50px" onkeyup="clearNoNum(this)"/>&nbsp;&nbsp;
    总价值($) <input name="SumGoodsWorth" type="text" id="SumGoodsWorth" class="inputBorder" size="10" value="<?php echo $this->_var['order_info']['SumGoodsWorth']; ?>" style="width:50px" onkeyup="clearNoNum(this)"/>      
    </td>
  </tr>            
</table>
<table width="100%" cellspacing="1" class="kdorder_add" style="margin-top:15px;font-family:simsun">
  <tr><td class="title_h1">&nbsp;三、选择服务项目</td></tr>
  <tr>
      <td>
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
       <tr><td><ul class="fuwu_xz">
       <?php $_from = $this->_var['fuwu_data']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'list');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['list']):
?>
       <?php if ($this->_var['list']['title'] != "保险" && $this->_var['list']['title'] != "小件物品单件加固" && $this->_var['list']['title'] != "拼箱"): ?>
       <li><label><input name="ServiceItems[]" type="checkbox" value="<?php echo $this->_var['key']; ?>" <?php if ($this->_var['list']['check'] > 0): ?>checked="checked"<?php endif; ?> /> <?php echo $this->_var['list']['title']; ?> <font color="#FF0000">$<?php echo $this->_var['list']['amount']; ?></font>/<?php echo $this->_var['list']['link']; ?></label></li>
       <?php endif; ?>
       <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
       </ul></td></tr><tr><td style="padding:0 8px;"><label><input name="ServiceItemsFix" id="ServiceItemsFix" type="checkbox" value="10" onclick="IsDivideShow('ServiceItemsFix','singleDiv');" <?php if ($this->_var['ServiceItems']['Fix']['0'] > 0): ?>checked="checked"<?php endif; ?>/> 小件物品单件加固 <font color="#FF0000">$<?php echo $this->_var['fuwu_data']['10']['amount']; ?>/</font><?php echo $this->_var['fuwu_data']['10']['link']; ?></label>
       <div id="singleDiv" style="display:<?php if ($this->_var['ServiceItems']['Fix']['0'] > 0): ?>block<?php else: ?>none<?php endif; ?>">加固数量 <input name="SinglgFixAmount" type="text" id="SinglgFixAmount" onkeyup="clearNoNum(this)" class="inputBorder" value="<?php echo $this->_var['ServiceItems']['Fix']['1']; ?>" maxlength="3" style="width:40px;"/> 加固说明 <input name="SingleFixMemo" type="text" id="SingleFixMemo" class="inputBorder" value="<?php echo $this->_var['ServiceItems']['Fix']['2']; ?>" maxlength="200" style="width:100px;"/></div></td></tr>
       <tr><td>
       <label><input name="ServiceItemsBx" id="ServiceItemsBx" type="checkbox" value="11" onclick="IsDivideShow('ServiceItemsBx','protectDiv');" <?php if ($this->_var['ServiceItems']['Bx']['0'] > 0): ?>checked="checked"<?php endif; ?>/> 保险</label>
       <span id="protectDiv" style="<?php if ($this->_var['ServiceItems']['Bx']['0'] > 0): ?><?php else: ?>display:none<?php endif; ?>">&nbsp;&nbsp;保价金额：$<input type="text" id="ProtectAmount" class="inputBorder" style="width:40px;" name="ProtectAmount" onkeyup="clearNoNumbx(this)" value="<?php echo $this->_var['ServiceItems']['Bx']['1']; ?>"/>  收取费用(<?php echo $this->_var['fuwu_data']['11']['amount']; ?><?php echo $this->_var['fuwu_data']['11']['link']; ?>)</span>
       </td></tr>
      </table>
      </td>
  </tr>
</table>
<table width="100%" cellspacing="1" class="kdorder_add" style="margin-top:15px;">
  <tr><td class="title_h1">&nbsp;四、填写发货地址</td></tr>
  <tr>
    <td><input name="extm_id" type="hidden" value="<?php echo $this->_var['order_info']['extm_id']; ?>"/>
    <?php if ($this->_var['my_address']['2']): ?>
    <?php $_from = $this->_var['my_address']['2']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'address');$this->_foreach['address_select'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['address_select']['total'] > 0):
    foreach ($_from AS $this->_var['address']):
        $this->_foreach['address_select']['iteration']++;
?>
    <div class="receive_add address_item">
    <label><input id="address_<?php echo $this->_var['address']['addr_id']; ?>" type="radio" name="address_options" value="<?php echo $this->_var['address']['addr_id']; ?>" class="radio" <?php if ($this->_var['order_info']['txt_id'] == $this->_var['address']['addr_id'] || ( ! $this->_var['order_info']['order_id'] && $this->_var['address']['default_use'] == 1 )): ?>checked="true"<?php endif; ?>/>
    <?php echo htmlspecialchars($this->_var['address']['consignee']); ?><?php echo htmlspecialchars($this->_var['address']['region_name']); ?>&nbsp;&nbsp;<?php echo str_replace('//', ' ', $this->_var['address']['txt_countrys']); ?><?php echo htmlspecialchars($this->_var['address']['address']); ?>&nbsp;&nbsp;<?php if ($this->_var['address']['phone_mob']): ?><?php echo $this->_var['address']['phone_mob']; ?><?php else: ?><?php echo $this->_var['address']['phone_tel']; ?><?php endif; ?>&nbsp;&nbsp;<?php echo htmlspecialchars($this->_var['address']['zipcode']); ?></label>
    <INPUT id="on_pro_<?php echo $this->_var['address']['addr_id']; ?>" type="hidden" value="<?php echo $this->_var['address']['parents_region_id']; ?>">
    </div>
    <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>    
    <div class="new_receive_add address_item" style="color:#F00"><label><input type="radio" name="address_options" id="use_new_address" value="0" /> 填写新地址</label></div>
    <?php endif; ?>
    <table border="0" cellpadding="2" cellspacing="1" class="adders_cass" id="address_form">
      <tr>
        <th><em>*</em>寄件人：</th>
        <td><input name="txt_name" type="text" class="inputBorder" id="txt_name" value="<?php echo $this->_var['order_info']['txt_name']; ?>" maxlength="20"/></td>
      </tr>
      <tr>
        <th><em>*</em>手机/电话：</th>
        <td><input name="txt_mobilephone" type="text" class="inputBorder" id="txt_mobilephone" value="<?php echo $this->_var['order_info']['txt_mobilephone']; ?>" maxlength="30"/></td>
      </tr>
      <tr>
        <th><em>*</em>国家地区：</th>
        <td><input name="txt_country" type="text" class="inputBorder" id="txt_country" style="width:80px;" value="<?php echo $this->_var['order_info']['txt_country']; ?>" maxlength="30" placeholder="国家/地区"/>&nbsp;
          省州：<input name="txt_province" type="text" class="inputBorder" id="txt_province" style="width:80px;" value="<?php echo $this->_var['order_info']['txt_province']; ?>" maxlength="30" placeholder="省/州"/></td>
      </tr>
      <tr>
        <th><em>*</em>城市：</th>
        <td><input name="txt_city" type="text" class="inputBorder" id="txt_city" style="width:80px;" value="<?php echo $this->_var['order_info']['txt_city']; ?>" maxlength="30" placeholder="城市"/>&nbsp;
            邮编：<input name="txt_postoffice" type="text" class="inputBorder" id="txt_postoffice" style="width:80px;" onkeyup="clearNoNum(this)" value="<?php echo $this->_var['order_info']['txt_postoffice']; ?>" maxlength="20" placeholder="邮政编码"/></td>
      </tr>
      
      <tr>
        <th><em>*</em>详细地址：</th>
        <td><input name="txt_address" type="text" class="inputBorder" id="txt_address" value="<?php echo $this->_var['order_info']['txt_address']; ?>" maxlength="255"/></td>
      </tr>
      <tr>
        <th>&nbsp;</th>
        <td><label><input name="save_address" type="checkbox" id="save_address" value="1" <?php if (! $this->_var['my_address']): ?>checked="checked"<?php endif; ?>>&nbsp;<font color="#FF0000">保存到地址薄</font></label></td>
      </tr>      
	</table>
    </td>
  </tr>
</table>
<table width="100%" cellspacing="1" class="kdorder_add" style="margin-top:15px;">
  <tr><td class="title_h1">&nbsp;五、填写收货地址</td></tr>
  <tr>
    <td>
    <?php if ($this->_var['my_address']['1']): ?>
    <?php $_from = $this->_var['my_address']['1']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'address');$this->_foreach['address_select'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['address_select']['total'] > 0):
    foreach ($_from AS $this->_var['address']):
        $this->_foreach['address_select']['iteration']++;
?>
    <div class="receive_add address_item">
    <label><input id="address_<?php echo $this->_var['address']['addr_id']; ?>" type="radio" name="address_options1" value="<?php echo $this->_var['address']['addr_id']; ?>" class="radio" <?php if ($this->_var['order_info']['txtRece_id'] == $this->_var['address']['addr_id'] || ( ! $this->_var['order_info']['order_id'] && $this->_var['address']['default_use'] == 1 )): ?>checked="true"<?php endif; ?>/>
    <?php echo htmlspecialchars($this->_var['address']['consignee']); ?><?php echo htmlspecialchars($this->_var['address']['region_name']); ?>&nbsp;&nbsp;<?php echo str_replace('//', ' ', $this->_var['address']['txt_countrys']); ?><?php echo htmlspecialchars($this->_var['address']['address']); ?>&nbsp;&nbsp;<?php if ($this->_var['address']['phone_mob']): ?><?php echo $this->_var['address']['phone_mob']; ?><?php else: ?><?php echo $this->_var['address']['phone_tel']; ?><?php endif; ?>&nbsp;&nbsp;<?php echo htmlspecialchars($this->_var['address']['zipcode']); ?></label>
    <INPUT id="on_pro_<?php echo $this->_var['address']['addr_id']; ?>" type="hidden" value="<?php echo $this->_var['address']['parents_region_id']; ?>">
    </div>
    <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>    
    <div class="new_receive_add address_item" style="color:#F00"><label><input type="radio" name="address_options1" id="use_new_address" value="0"/> 填写新地址</label></div>   
    <?php endif; ?>  
  <table border="0" cellpadding="2" cellspacing="1" class="adders_cass" id="address_form1">
    <tr>
      <th><em>*</em>收件人：</th>
      <td><input name="txtRece_name" type="text" class="inputBorder" id="txtRece_name" value="<?php echo $this->_var['order_info']['txtRece_name']; ?>" maxlength="20"/></td>
    </tr>
    <tr>
      <th><em>*</em>手机/电话：</th>
      <td><input name="txtRece_mobilephone" type="text" class="inputBorder" id="txtRece_mobilephone" value="<?php echo $this->_var['order_info']['txtRece_mobilephone']; ?>" maxlength="30"/></td>
    </tr>
    <tr>
      <th><em>*</em>国家/地区：</th>
      <td><input name="txtRece_country" type="text" class="inputBorder" id="txtRece_country" style="width:80px;" value="<?php echo $this->_var['order_info']['txtRece_country']; ?>" maxlength="30" placeholder="国家/地区"/>&nbsp;
        省州：<input name="txtRece_province" type="text" class="inputBorder" id="txtRece_province" style="width:80px;" value="<?php echo $this->_var['order_info']['txtRece_province']; ?>" maxlength="30" placeholder="省/州"/></td>
    </tr>
    <tr>
      <th><em>*</em>城市/区：</th>
      <td><input name="txtRece_city" type="text" class="inputBorder" id="txtRece_city" style="width:80px;" value="<?php echo $this->_var['order_info']['txtRece_city']; ?>" maxlength="30" placeholder="城市"/>&nbsp;
        区域：<input name="txtqu" type="text" class="inputBorder" id="txtqu" style="width:80px;" value="<?php echo $this->_var['order_info']['txtqu']; ?>" maxlength="30" placeholder="区"/>
       </td>
    </tr>    
    <tr>
      <th><em>*</em>详细地址：</th>
      <td><input name="txtRece_address" type="text" class="inputBorder" id="txtRece_address" value="<?php echo $this->_var['order_info']['txtRece_address']; ?>" size="50" maxlength="255"/></td>
    </tr>
      <tr>
        <th><em>*</em>邮政编码：</th>
        <td><input name="txtRece_postoffice" type="text" class="inputBorder" id="txtRece_postoffice" onkeyup="clearNoNum(this)" value="<?php echo $this->_var['order_info']['txtRece_postoffice']; ?>" maxlength="20" placeholder="请填写邮政编码"/></td>
      </tr>     
    <tr>
      <th>区域类别：</th>
      <td><label><input id="rbtnyes" type="radio" name="idpic" value="rbtnyes" <?php if ($this->_var['order_info']['idpic'] != 'rbtnno'): ?>checked="checked"<?php endif; ?>/> 大陆地区</label>
      <label><input id="rbtnno" type="radio" name="idpic" value="rbtnno" <?php if ($this->_var['order_info']['idpic'] == 'rbtnno'): ?>checked="checked"<?php endif; ?>/> 非大陆地区</label></td>
    </tr>    
    <tr>
      <th><em>*</em>身份证号：</th>
      <td><input name="txtidcode" type="text" class="inputBorder" id="txtidcode" value="<?php echo $this->_var['order_info']['txtidcode']; ?>" size="50" maxlength="30" placeholder="身份证号码必填方便清关"/></td>
    </tr>   
    <tr>
      <th>&nbsp;</th>
      <td><label><input name="save_address1" type="checkbox" id="save_address1" value="1" <?php if (! $this->_var['my_address']): ?>checked="checked"<?php endif; ?>>&nbsp;<font color="#FF0000">保存到地址薄</font></label></td>
    </tr>        
  </table>  
    </td>
  </tr>
</table>
<table width="100%" cellspacing="1" class="kdorder_add" style="margin-top:15px;font-family:simsun">
  <tr><td class="title_h1">&nbsp;六、运单备注</td></tr>
  <tr>
    <td><textarea name="Memo" id="Memo" class="text" placeholder="如果其他要求请填写备注"><?php echo $this->_var['order_info']['Memo']; ?></textarea></td>
  </tr>
</table>
<div style="margin: 10px;padding-bottom: 15px;">
  <?php if ($this->_var['order_info']['status'] <= 0): ?>
  <input type="button" name="imgButton" class="button_css" value="确认提交" onclick="return Check_form();" />
  <?php else: ?><p style="font-size:15px; color:#F00">入库的运单不能修改资料</p>
  <?php endif; ?>
  <?php if ($this->_var['order_info']['order_id']): ?>
  <input type="hidden" name="order_id"  value="<?php echo $this->_var['order_info']['order_id']; ?>"/><input type="hidden" name="act"  value="edit"/>
  <?php else: ?>
  <input type="hidden" name="act"  value="add"/>
  <?php endif; ?>
</div>
</form>
<script type="text/javascript">
var addresses = <?php echo $this->_var['my_address_json']; ?>;
$(function(){
    $('input[name="address_options"]').click(function(){
        $(this).attr('checked', true);
		$('input[name="save_address"]').attr("checked",'true');
        set_address(1,'click');
    });	
    $('input[name="address_options1"]').click(function(){
        $(this).attr('checked', true);
		$('input[name="save_address1"]').attr("checked",'true');
		set_address(2,'click');
    });							
    set_address(1);
	set_address(2);
});
function set_address(whereID,Clicks){
 if(whereID==2){
    var addr_id = $("input[name='address_options1']:checked").val();
    if(addr_id == 0 || typeof(addr_id) == 'undefined'){
		if(addr_id == 0 && Clicks == 'click'){
		$('#txtRece_name').val(""); $('#txtRece_mobilephone').val(""); $('#txtRece_email').val("");$('#txtRece_country').val(""); $('#txtRece_province').val(""); $('#txtRece_city').val("");$('#txtqu').val(""); 
		$('#txtRece_postoffice').val(""); $('#txtRece_address').val("");$('#txtidcode').val("");$("input[type=radio][name=idpic][value='rbtnyes']").attr("checked",true); 
		}
		$("input[type=radio][name=address_options1][value='0']").attr("checked",true); 
		$('#address_form1').show();			
    }else{
		var addr_data = addresses[addr_id];	
		$('#address_form1').hide();	
		$("input[name='txtRece_name']").val(addr_data['consignee']);
		$("input[name='txtRece_mobilephone']").val(addr_data['phone_mob']);
		var split_trys = addr_data['txt_countrys'].split("//"); //字符国家省市
		$("input[name='txtRece_country']").val(split_trys[0]);
		$("input[name='txtRece_province']").val(split_trys[1]);
		$("input[name='txtRece_city']").val(split_trys[2]);
		$("input[name='txtqu']").val(split_trys[3]);
		$("input[name='txtRece_postoffice']").val(addr_data['zipcode']);
		$("input[name='txtRece_address']").val(addr_data['address']);
		if(addr_data['idpic']=='rbtnyes'){
			$("input[type=radio][name=idpic][value='rbtnyes']").attr("checked",true);  
		}else{
			$("input[type=radio][name=idpic][value='rbtnno']").attr("checked",true);  
		}
		$("input[name='txtidcode']").val(addr_data['txtidcode']);	
    }
 }else{
    var addr_id = $("input[name='address_options']:checked").val();
    if(addr_id == 0 || typeof(addr_id) == 'undefined'){
		if(addr_id == 0 && Clicks == 'click'){
		$('#txt_name').val(""); $('#txt_mobilephone').val(""); $('#txt_country').val(""); $('#txt_province').val(""); $('#txt_city').val(""); $('#txt_postoffice').val(""); $('#txt_address').val("");
		}
		$("input[type=radio][name=address_options][value='0']").attr("checked",true); 
		$('#address_form').show();
    }else{
		var addr_data = addresses[addr_id];	
		$('#address_form').hide();
		$("input[name='txt_name']").val(addr_data['consignee']);
		$("input[name='txt_mobilephone']").val(addr_data['phone_mob']);
		var split_trys = addr_data['txt_countrys'].split("//"); //字符国家省市
		$("input[name='txt_country']").val(split_trys[0]);
		$("input[name='txt_province']").val(split_trys[1]);
		$("input[name='txt_city']").val(split_trys[2]);
		$("input[name='txt_postoffice']").val(addr_data['zipcode']);
		$("input[name='txt_address']").val(addr_data['address']);
    }	
 }
}
//sumbit form
function Check_form() {
  if ($("#FromCountry").val() == "0" && $("#FaHuoDi").val() == "") {alert("请选择发货地");$("#FromCountry").focus(); return false;}
  if ($("#ToCountry").val() == "0" && $("#ShouHuoDi").val() == "") {alert("请选择收货地");$("#ToCountry").focus(); return false;}
  if ($("#ExpressCompany").val() == "0" && $("#CangKuDiZhi").val() == "") {alert("请选择所在仓库");$("#ExpressCompany").focus(); return false;}
  if ($("#TransportType").val() == "0" && $("#ZhuanYunFangShi").val() == "") {alert("请选择转运方式");$("#TransportType").focus(); return false;}  
  for (var i = 0; i < document.getElementsByName("GoodsName[]").length; i++) {
      if (document.getElementsByName("GoodsName[]")[i].value == "" || document.getElementsByName("GoodsName[]")[i].value == "选择物品") {
		  alert("物品名不能为空"); return false;
	  }
	  if (document.getElementsByName("GoodsCount[]")[i].value == "" || document.getElementsByName("GoodsCount[]")[i].value == "0") {
		  alert("物品数量不能为空且必须大于0");document.getElementsByName("GoodsCount[]")[i].focus(); return false;
	  }
	  if (document.getElementsByName("GoodsWorth[]")[i].value == "" || document.getElementsByName("GoodsWorth[]")[i].value == "0") {
		  alert("物品价值不能为空且必须大于0");document.getElementsByName("GoodsWorth[]")[i].focus(); return false;
	  }
  }
  if ($("#ServiceItemsFix")) {
	  if ($("#ServiceItemsFix").attr("checked")) {
		  if ($("#SinglgFixAmount").val() == "") {alert("内部单件物品加固数量不能为空");$("#SinglgFixAmount").focus(); return false;}
		  if ($("#SingleFixMemo").val() == "") {alert("内部单件物品加固备注不能为空");$("#SingleFixMemo").focus(); return false;}
	  }
  }
  if ($("#ServiceItemsBx")) {
	  if ($("#ServiceItemsBx").attr("checked")) {
		  if ($("#ProtectAmount").val() == "") {alert("保价金额不能为空");$("#ProtectAmount").focus(); return false;}
	  }
  }
  var flag = false;
  if ($("#txt_name").val() == "") {alert("寄件人姓名不能为空");$("#txt_name").focus(); return false;}
  if ($("#txt_mobilephone").val() == "") { 
	  alert("寄件人手机/电话不能为空");$("#txt_mobilephone").focus(); return false; 
  }else{
	  var newstr = $("#txt_mobilephone").val().replace(/\-/g, "");
	  if(/^[0-9\\-]*$/.test($("#txt_mobilephone").val()) == false){alert("手机/电话只能输入数字或者-横线，请正确输入");$("#txt_mobilephone").focus(); return false;}
	  if(newstr.length < 10 || newstr.length > 13){alert("您输入的寄件人手机/电话的格式有误，请输入10-13位的手机/电话号码");$("#txt_mobilephone").focus(); return false;}	  
  }
  if ($("#txt_country").val() == "") {alert("寄件人所在国家不能为空");$("#txt_country").focus(); return false;}
  if ($("#txt_province").val() == "") {alert("寄件人所在省/州不能为空");$("#txt_province").focus(); return false;}
  if ($("#txt_city").val() == "") {alert("寄件人所在城市不能为空");$("#txt_city").focus(); return false;}
  if ($("#txt_address").val() == "") {alert("寄件人详细地址不能为空");$("#txt_address").focus(); return false;}
  
  flag = false;
  if ($("#txtRece_name").val() == "") {alert("收件人姓名不能为空");$("#txtRece_name").focus(); return false;}
  if ($("#txtRece_mobilephone").val() == "") { 
      alert("收件人手机/电话不能为空");$("#txtRece_mobilephone").focus(); return false; 
  }else{
	  if(checkTel($("#txtRece_mobilephone").val()) == false){alert("错误的格式，请输入中国地区正确的手机号码或者电话号码");$("#txtRece_mobilephone").focus(); return false;}
  }
  if ($("#txtRece_country").val() == "") {alert("收件人所在国家不能为空");$("#txtRece_country").focus(); return false;}
  if ($("#txtRece_province").val() == "") {alert("收件人所在省/州不能为空");$("#txtRece_province").focus(); return false;}
  if ($("#txtRece_city").val() == "") {alert("收件人所在城市不能为空");$("#txtRece_city").focus(); return false;}
  if ($("#txtRece_address").val() == "") {alert("收件人详细地址不能为空");$("#txtRece_address").focus(); return false;}
  if ($("#txtidcode").val() == "") { 
     alert("收件人身份证号码不能为空");$("#txtidcode").focus(); return false; 
  }else{
	 if ($("#txtidcode").val().length != 15 && $("#txtidcode").val().length != 18) {
		  alert("输入身份证号码格式不正确，必须是15位或者18位的有效号码!");
		  $("#txtidcode").focus();
		  return (false);
	  }
  }
  $("#form_box").submit();
}

function ClearItem(wupin_id) {
	$("#" + wupin_id).find("#GoodsName").val('选择物品');
	$("#" + wupin_id).find("#GoodsCount").val('0');
	$("#" + wupin_id).find("#GoodsWorth").val('0');
}
function postofficchange(j, d) {
  var content = j.options[j.selectedIndex].text;
  if (content == "送货上门" || content == "司机取件") {
	  $("#"+d+" #PostNumber").val('无跟踪号');
  } else {
	  if($("#"+d+" #PostNumber").val() == "无跟踪号")  $("#"+d+" #PostNumber").val('');
  }
}
function IsDivideShow(id1,id2){ 
  if($("#"+id1).attr("checked")){ 
    $("#"+id2).show(); 
  }else{ 
    $("#"+id2).hide(); 
  } 
}
function checkTel(value){
	var isPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
	var isMob=/^((\+?86)|(\(\+86\)))?(13[0123456789][0-9]{8}|15[012356789][0-9]{8}|18[02356789][0-9]{8}|147[0-9]{8})$/;
	if(isMob.test(value)||isPhone.test(value)){
		return true;
	}else{
		return false;
	}
}
</script>
<?php else: ?>

<style>
.order_form{color:#333}
.order_form td {font-size:13px}
.order_form h1 {padding:10px 0;width:100%;font-size:15px; color:#e52f21;overflow:hidden; font-family:'Microsoft Yahei'; text-indent:8px}
.order_form .title_h2 {text-align:right;font-weight:bold;font-family:'Microsoft Yahei'; width:90px}
.order_form .kdorder_add {margin-bottom:15px;}
.order_form .kdorder_add td{padding:6px 0}
</style>
<div class="order_form">
  <h1>运单基本信息</h1>
  <table cellspacing="1" width="100%" class="kdorder_add">
    <tr>
      <td class="title_h2" style="background:#FBFBFB">订单编号：</td>
      <td colspan="3"><?php echo $this->_var['order_info']['order_sn']; ?></td>
    </tr>
    <?php if ($this->_var['order_info']['express']): ?>
    <tr>
      <td class="title_h2" style="background:#FBFBFB">快递单号：</td>
      <td colspan="3"><?php echo $this->_var['order_info']['express']; ?> <a href="<?php echo $this->_var['site_url']; ?>/<?php echo url('app=kd_order&ydh=' . $this->_var['order_info']['yundanhao']. ''); ?>" target="_blank" ><?php echo $this->_var['order_info']['yundanhao']; ?></a></td>
    </tr>
    <?php endif; ?>
    <tr>
      <td class="title_h2" style="background:#FBFBFB">订单状态：</td>
      <td colspan="3"><?php if ($this->_var['order_info']['status'] == '0'): ?><font color="#f00">未入库</font>
        <?php elseif ($this->_var['order_info']['status'] == '1'): ?><font color="#FF9900">部分入库</font>
        <?php elseif ($this->_var['order_info']['status'] == '2'): ?><font color="#009966">已入库</font>
        <?php elseif ($this->_var['order_info']['status'] == '3'): ?><font color="#00f">待付款</font>
        <?php elseif ($this->_var['order_info']['status'] == '5'): ?><font color="#3399CC">已付款</font>
        <?php elseif ($this->_var['order_info']['status'] == '6'): ?><font color="#FF00FF">待发货</font>
        <?php elseif ($this->_var['order_info']['status'] == '7'): ?><font color="#336600">已发货</font>
        <?php elseif ($this->_var['order_info']['status'] == '8'): ?>已完成
        <?php elseif ($this->_var['order_info']['status'] == '9'): ?><font color="#999">已取消</font>
        <?php endif; ?></td>
      </tr><tr>
      <td class="title_h2" style="background:#FBFBFB">下单日期：</td>
      <td colspan="3"><?php echo local_date("Y-m-d H:i:s",$this->_var['order_info']['addtime']); ?></td>
      </tr>
    <?php if ($this->_var['order_info']['totalfei'] > 0): ?>
    <tr>
      <td colspan="4" class="title_h1">费用明细</td></tr>
    <tr>
      <td class="title_h2">运费：</td>
      <td><?php echo price_format($this->_var['order_info']['yunfei']); ?> 美元</td>
      <td class="title_h2">增值服务费：</td>
      <td><?php echo price_format($this->_var['order_info']['fuwufei']); ?> 美元 </td>
    </tr>
    <tr>
      <td class="title_h2">保险费：</td>
      <td><?php echo price_format($this->_var['order_info']['baoxianfei']); ?> 美元</td>
      <td class="title_h2">仓库操作费：</td>
      <td><?php echo price_format($this->_var['order_info']['caozuofei']); ?> 美元</td>
    </tr>
    <tr>
      <td class="title_h2">关税：</td>
      <td><?php echo price_format($this->_var['order_info']['guanshuifei']); ?> 美元</td>
      <td class="title_h2">仓储费：</td>
      <td><?php echo price_format($this->_var['order_info']['cangchufei']); ?> 美元 </td>
    </tr>
    <tr>
      <td class="title_h2">其它费用：</td>
      <td><?php echo price_format($this->_var['order_info']['qitafei']); ?> 美元</td>
      <td style="color:#F00" class="title_h2">共需支付：</td>
      <td style="color:#F00"><?php echo price_format($this->_var['order_info']['totalfei']); ?> 美元</td>
    </tr>
    <?php if ($this->_var['order_info']['Memo_fei']): ?>
    <tr>
      <td class="title_h2" valign="top">费用说明：</td>
      <td colspan="3"><?php echo(@ereg_replace("\r\n","<br />",$this->_var['order_info']['Memo_fei'])); ?></td>
    </tr>
    <?php endif; ?>
    <?php endif; ?>
    
  </table>  
  <table cellspacing="1" width="100%" class="kdorder_add">
    <tr><td colspan="2" class="title_h1">&nbsp;一、客户委托项目</td></tr>
    <tr>
      <td class="title_h2">发货地：</td>
      <td><?php echo ($this->_var['order_info']['FaHuoDi'] == '') ? '-' : $this->_var['order_info']['FaHuoDi']; ?></td>
      </tr>
    <tr>
      <td class="title_h2">收货地：</td>
      <td><?php echo ($this->_var['order_info']['ShouHuoDi'] == '') ? '-' : $this->_var['order_info']['ShouHuoDi']; ?></td>
    </tr>
    <tr>
      <td class="title_h2">所在仓库：</td>
      <td><?php echo ($this->_var['order_info']['CangKuDiZhi'] == '') ? '-' : $this->_var['order_info']['CangKuDiZhi']; ?></td>
      </tr><tr>
      <td class="title_h2">转运方式：</td>
      <td><?php echo ($this->_var['order_info']['ZhuanYunFangShi'] == '') ? '-' : $this->_var['order_info']['ZhuanYunFangShi']; ?></td>
     </tr>
  </table>
  <table width="100%" cellspacing="0" class="kdorder_add" style="margin-top:15px" id="wupin_add">
    <tr>
      <td class="title_h1">&nbsp;二、快件物品详情</td></tr>
    <tr>
        <td style="padding:0"></td>
    </tr>
    <?php $_from = $this->_var['order_info']['goodswupin']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'wupin');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['wupin']):
?>
    <tr id="wupin_id_<?php echo($this->_var['key']+3);?>">
      <td style="padding:0">
      <div class="wupin_sc">
        <p>发货跟踪：<?php if ($this->_var['wupin']['PostOfficeID']): ?><?php echo $this->_var['wupin']['PostOfficeID']; ?>：<?php endif; ?><?php echo $this->_var['wupin']['yundanhao']; ?></p>
        <p>商品明细：<?php echo ($this->_var['wupin']['GoodsName'] == '') ? '-' : $this->_var['wupin']['GoodsName']; ?></p>
        <p>商品数量：<?php echo price_format($this->_var['wupin']['GoodsCount']); ?>&nbsp;&nbsp;&nbsp;&nbsp;申报价值($)：<?php echo price_format($this->_var['wupin']['GoodsCount']); ?></p>
      </div>    
      </td>
    </tr>
    <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
    <tr>
    <td colspan="4" style="background:#f0f7ff">&nbsp;物品数量合计：<strong style="color:#F00"><?php echo $this->_var['order_info']['SumGoodsAmount']; ?></strong>&nbsp;&nbsp;&nbsp;&nbsp;物品价值合计：<strong style="color:#F00"><?php echo price_format($this->_var['order_info']['SumGoodsWorth']); ?></strong></td>
    </tr>     
  </table>    
  <table width="100%" cellspacing="1" class="kdorder_add">
    <tr><td class="title_h1">&nbsp;三、服务项目</td></tr>
    <tr>
      <td style="padding:6px">
      <ul class="fuwu_xz">
       <?php $_from = $this->_var['fuwu_data']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'list');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['list']):
?>
       <?php if ($this->_var['list']['check'] > 0): ?><li>(√)<?php echo $this->_var['list']['title']; ?> <font color="#FF0000">$<?php echo $this->_var['list']['amount']; ?></font>/<?php echo $this->_var['list']['link']; ?></li><?php endif; ?>
       <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
       </ul>
       <?php if ($this->_var['ServiceItems']['Fix']['0'] > 0): ?><p style="padding:8px 0;">(√)小件物品单件加固 <font color="#FF0000">$<?php echo $this->_var['fuwu_data']['10']['amount']; ?>/</font><?php echo $this->_var['fuwu_data']['10']['link']; ?>&nbsp;&nbsp;加固数量：<?php echo $this->_var['ServiceItems']['Fix']['1']; ?>&nbsp;&nbsp;加固物品说明：<?php echo $this->_var['ServiceItems']['Fix']['2']; ?></p><?php endif; ?>
       <?php if ($this->_var['ServiceItems']['Bx']['0'] > 0): ?><p style="padding:8px 0">(√)保险&nbsp;&nbsp;保价金额：$<?php echo $this->_var['ServiceItems']['Bx']['1']; ?></p><?php endif; ?>
      </td>
    </tr>
  </table> 
  <table width="100%" cellspacing="1" class="kdorder_add">
    <tr><td colspan="2" class="title_h1">&nbsp;四、发货地址</td></tr>
    <tr>
        <td class="title_h2">寄件人：</td>
        <td><?php echo $this->_var['order_info']['txt_name']; ?></td>
        </tr>
    <tr>
      <td class="title_h2">手机/电话：</td>
      <td><?php echo $this->_var['order_info']['txt_mobilephone']; ?></td>
      </tr>
    <tr>
      <td class="title_h2">国家/地区：</td>
      <td><?php echo str_replace('//', ' ', $this->_var['order_info']['txt_countrys']); ?></td>
      </tr>
    <tr>
      <td class="title_h2">详细地址：</td>
      <td><?php echo $this->_var['order_info']['txt_address']; ?></td>
    </tr>
    <tr>
      <td class="title_h2">邮编：</td>
      <td><?php echo $this->_var['order_info']['txt_postoffice']; ?></td>
    </tr>
   </tr>
    <tr>
      <td colspan="2" height="5"></td>
      </tr>
   </tr>   
    <tr><td colspan="2" class="title_h1">&nbsp;五、收货地址</td></tr>
    <tr>
        <td class="title_h2">寄件人：</td>
        <td><?php echo $this->_var['order_info']['txtRece_name']; ?></td>
        </tr>
    <tr>
      <td class="title_h2">手机/电话：</td>
      <td><?php echo $this->_var['order_info']['txtRece_mobilephone']; ?></td>
      </tr>
    <tr>
      <td class="title_h2">国家/地区：</td>
      <td><?php echo str_replace('//', ' ', $this->_var['order_info']['txtRece_countrys']); ?></td>
    </tr> 
    <tr>
      <td class="title_h2">详细地址：</td>
      <td><?php echo $this->_var['order_info']['txtRece_address']; ?></td>
    </tr>
    <tr>
      <td class="title_h2">邮编：</td>
      <td><?php echo $this->_var['order_info']['txtRece_postoffice']; ?></td>
    </tr>
    <tr>
      <td class="title_h2">地址区域：</td>
      <td><?php if ($this->_var['order_info']['idpic'] == 'rbtnyes'): ?>大陆地区<?php else: ?>非大陆地区<?php endif; ?></td>
    </tr>
    <tr>
      <td class="title_h2">身份证号码：</td>
      <td><?php echo $this->_var['order_info']['txtidcode']; ?></td>
    </tr>          
  </table> 
  <?php if ($this->_var['order_info']['Memo']): ?>
  <table width="100%" cellspacing="1" class="kdorder_add">
    <tr>
      <td class="title_h1">&nbsp;六、运单备注</td></tr>
    <tr><td><?php echo $this->_var['order_info']['Memo']; ?></td></tr>
  </table> 
  <?php endif; ?>    
</div>
<?php endif; ?>
</div></div>
</div>
</div>

</div>
</body>
</html>